const Util = {
	isForm(node) {


		return node instanceof HTMLInputElement ;
	},


	prototype3(node) {
		const prototypes = []
		if(!node || !node.__proto__) {return prototypes};


		var ret = this.prototype3(node.__proto__)
		prototypes.push(...ret)
		// 可以控制方向
		prototypes.push(node.__proto__);

		return prototypes
	},

	// 获取原型链
	prototype2(node) {
		const prototypes = []
		if(!node) {return prototypes};
		prototypes.push(node.__proto__, ...this.prototype2(node.__proto__))
		return prototypes;
	},

	// 获取原型链
    prototype(node) {
        const prototypes = []
        prototypes.push(node.__proto__)

        prototypes.push(...(node.__proto__ ? this.prototype(node.__proto__) : []))
        return prototypes
    },
}

//添加原型方法
Node.prototype.substr =  function(start, num) {

	if(Util.isForm(this)) {
		return this.value.substr(start, num)
	} else {
		return this.textContent.substr(start, num)
	}
}

 
console.log(Util.prototype2(hdcms))
console.log(Util.prototype(hdcms))
console.log(Util.prototype3(hdcms))


